#!/bin/sh

# AWS IoT Client test

# Check for application
[ ! -x ./examples/aws/awsiot ] && echo -e "\n\nAWS IoT MQTT Client doesn't exist" && exit 1

def_args="-T -C 2000"

# Run with TLS and QoS 0-1

./examples/aws/awsiot $def_args -t -q 0 $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nAWS IoT MQTT Client failed! TLS=On, QoS=0" && exit 1

./examples/aws/awsiot $def_args -t -q 1 $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nAWS IoT MQTT Client failed! TLS=On, QoS=1" && exit 1

echo -e "\n\nAWS IoT MQTT Client Tests Passed"

exit 0
